package leetcode.editor.cn.q1xx

import leetcode.editor.cn.TreeNode

class Q100 {

    fun isSameTree(p: TreeNode?, q: TreeNode?): Boolean {
        if (p == null && q == null) {
            return true
        }
        if ((p == null && q != null) || (p != null && q == null)) {
            return false
        }
        p!!
        q!!
        return (q.`val` == p.`val`) && isSameTree(p.left, q.left) && isSameTree(p.right, q.right)
    }
}